package cn.ywsj.ywsjmidtier.controller;

import cn.ywsj.ywsjmidtier.entity.VO.*;
import cn.ywsj.ywsjmidtier.service.WechatSubstituteFeign;
import cn.ywsj.ywsjmidtier.utils.JsonObjectUtil;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping({"/wechat/member/substitutesalemgr"})
public class WechatSubstituteController {

    @Autowired
    private WechatSubstituteFeign substituteFeign;

    @GetMapping(value = {"/tosubstitutelist"})
    public String substituteList() {
        return substituteFeign.substituteList();
    }

    @GetMapping(value = {"/selectsubstitutelist"})
    public String substituteList(Long custId) {
        return substituteFeign.substituteList(custId);
    }

    @PostMapping(value = {"/ajaxsubstitutelist"})
    public String querySubstituteList(Integer start,Integer pageSize) {
        return substituteFeign.querySubstituteList(start,pageSize);
    }

    @PostMapping(value = {"/ajaxsetsubstitute"})
    public String ajaxSetSubstitute(UpdateCompanyVo updateCompanyVo) {
       return substituteFeign.ajaxSetSubstitute(JsonObjectUtil.ObjectToJson(updateCompanyVo));
    }

    @PostMapping(value = {"/toapplysubstituteproduct"})
    public String applySubstituteList(Integer start,Integer pageSize) {
         return substituteFeign.applySubstituteList(start,pageSize);
    }

    @PostMapping(value = {"/ajaxaddsubstituteproduct"})
    public String ajaxaddSubstitute(SubstituteSaleProductVo substituteSaleProductVo, BindingResult result) {
       return substituteFeign.ajaxaddSubstitute(JsonObjectUtil.ObjectToJson(substituteSaleProductVo),result);
    }

    @PostMapping(value = {"/ajaxsubstituteproductlist"})
    public String substituteProductList(Integer start,Integer pageSize) {
        return substituteFeign.substituteProductList(start,pageSize);
    }

    @RequestMapping({"/detailproduct"})
    public String detailProduct(ProductQueryVo productQueryVo) {
         return substituteFeign.detailProduct(JsonObjectUtil.ObjectToJson(productQueryVo));
    }

    @RequestMapping({"/salecompanydetail"})
    public String companySaleDetail(Long custId, HttpServletResponse response) {
         return substituteFeign.companySaleDetail(custId,response);
    }

    @PostMapping(value = {"/ajaxauditsubstituteproduct"})
    public String ajaxAuditSubstitute(SubstituteSaleProductVo substituteSaleProductVo, BindingResult result) {
        return substituteFeign.ajaxAuditSubstitute(JsonObjectUtil.ObjectToJson(substituteSaleProductVo),result);
    }

    @RequestMapping({"/substituteproductdetail"})
    public String substituteProductDetail(SubstituteSaleProductQueryVo substituteSaleProductQueryVo, Model model) {
        return substituteFeign.substituteProductDetail(JsonObjectUtil.ObjectToJson(substituteSaleProductQueryVo),model);
    }

    @PostMapping(value = {"/myapplytotal"})
    public String myApplytotal(SubstituteSaleProductQueryVo substituteSaleProductQueryVo) {
        return substituteFeign.myApplytotal(JsonObjectUtil.ObjectToJson(substituteSaleProductQueryVo));
    }

    @PostMapping(value = {"/mysaletotal"})
    public String mySaletotal(SubstituteSaleProductQueryVo substituteSaleProductQueryVo) {
        return substituteFeign.mySaletotal(JsonObjectUtil.ObjectToJson(substituteSaleProductQueryVo));
    }

    @PostMapping(value = {"/startsaletotal"})
    public String startSaletotal(ThOrderListQueryVo thOrderListQueryVo) {
       return substituteFeign.startSaletotal(JsonObjectUtil.ObjectToJson(thOrderListQueryVo));
    }

    @PostMapping(value = {"/receivesaletotal"})
    public String receiveSaletotal(ThOrderListQueryVo thOrderListQueryVo) {
        return substituteFeign.receiveSaletotal(JsonObjectUtil.ObjectToJson(thOrderListQueryVo));
    }
}
